#ifndef FORMIC_FQMC_FORTRAN_RGP_ENERGY_HEADER
#define FORMIC_FQMC_FORTRAN_RGP_ENERGY_HEADER

#include<complex>

#include<formic/exception.h>
#include<formic/fortran_mangle.h>

extern "C" {

  void FORMIC_FC_GLOBAL_(rgp_fortran_energy_aaaa,RGP_FORTRAN_ENERGY_AAAA)
         (   int * no,
             int * nv,
             double * tia,
             double * Tiajb,
             double * Bkl,
             double * Via,
             double * VBia,
             double * TVBjb,
             double * TVBaj,
             double * retval);

  void FORMIC_FC_GLOBAL_(rgp_fortran_energy_aabb,RGP_FORTRAN_ENERGY_AABB)
         (   int *     no,
             int *     nv,
          double *  Tiajb,
          double *    Via,
          double *    Ujb,
          double *    Pab,
          double *    Bkl,
          double *    Blk,
          double *   VBia,
          double *   BUjb,
          double *  VBUab,
          double *   TBab,
          double *  TVBjb,
          double * retval  );

}

namespace formic {

namespace fqmc {

  void rgp_aaaa_energy(int no,
                       int nv,
                       double * tia,
                       double * Tiajb,
                       double * Bkl,
                       double * Via,
                       double * VBia,
                       double * TVBjb,
                       double * TVBaj,
                       double * retval)
  {
    FORMIC_FC_GLOBAL_(rgp_fortran_energy_aaaa,RGP_FORTRAN_ENERGY_AAAA)
      (&no, &nv, tia, Tiajb, Bkl, Via, VBia, TVBjb, TVBaj, retval);
  }

  void rgp_aaaa_energy(int no,
                       int nv,
                       std::complex<double> * tia,
                       std::complex<double> * Tiajb,
                       std::complex<double> * Bkl,
                       std::complex<double> * Via,
                       std::complex<double> * VBia,
                       std::complex<double> * TVBjb,
                       std::complex<double> * TVBaj,
                       std::complex<double> * retval)
  {
    throw formic::Exception("no implementation of formic::fqmc::rgp_aaaa_energy for complex numbers");
  }

  void rgp_aabb_energy(int no,
                       int nv,
                       double * Tiajb,
                       double * Vmat,
                       double * Umat,
                       double * Xmat,
                       double * Bkl,
                       double * Blk,
                       double * VBia,
                       double * BUjb,
                       double * VBUab,
                       double * TBab,
                       double * TVBjb,
                       double * retval)
  {
    FORMIC_FC_GLOBAL_(rgp_fortran_energy_aabb,RGP_FORTRAN_ENERGY_AABB)
      (&no, &nv, Tiajb, Vmat, Umat, Xmat, Bkl, Blk, VBia, BUjb, VBUab, TBab, TVBjb, retval);
  }

  void rgp_aabb_energy(int no,
                       int nv,
                       std::complex<double> * Tiajb,
                       std::complex<double> * Vmat,
                       std::complex<double> * Umat,
                       std::complex<double> * Xmat,
                       std::complex<double> * Bkl,
                       std::complex<double> * Blk,
                       std::complex<double> * VBia,
                       std::complex<double> * BUjb,
                       std::complex<double> * VBUab,
                       std::complex<double> * TBab,
                       std::complex<double> * TVBjb,
                       std::complex<double> * retval)
  {
    throw formic::Exception("no implementation of formic::fqmc::rgp_aabb_energy for complex numbers");
  }

}

}

#endif
